package com.towexin.application.activiti.mapper;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.towexin.application.activiti.domain.ApproveInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ApproveInfoMapper extends BaseMapper<ApproveInfo> {
    @Select("SELECT\n" +
            "\ta.*,\n" +
            "\tCONCAT(\n" +
            "\t\tIFNULL( b.nickname, '' ),\n" +
            "\tIFNULL( c.role_name, '' )) assignee \n" +
            "FROM\n" +
            "\tt_approve_info a\n" +
            "\tLEFT JOIN t_user b ON a.user_or_role = b.username\n" +
            "\tLEFT JOIN t_role c ON a.user_or_role = c.mark \n" +
            "WHERE\n" +
            "\ta.process_instance_id = #{processInstanceId} \n" +
            "ORDER BY\n" +
            "\ta.timestamp ASC")
    List<ApproveInfo> getApproveInfoByProcessInstanceId(String processInstanceId);
}
